package com.bing.dao.sqlProvider;

import com.bing.bean.weixin.ResponseMessage;
import org.apache.ibatis.jdbc.SQL;

/**
 * Created by Administrator on 2014/12/13.
 */
public class MessageSQL {

    public String insert(final ResponseMessage message) {
        return new SQL() {
            {
                INSERT_INTO("Message");
                VALUES("msgType", "#{msgType}");
                VALUES("content", "#{content}");
                if (message.getImage() != null) {
                    VALUES("image", "#{image}");
                }
                if (message.getVideo() != null) {
                    VALUES("video", "#{video}");
                }
                if (message.getVoice() != null) {
                    VALUES("voice", "#{voice}");
                }
            }
        }.toString();
    }
}
